<?php
/**
 *
 * @author     Daniel Botelho <botelho.daniel@gmail.com>
 */
class StringUtil
{
  
  public static function appendableString($string, $appendable)
  {
    if($appendable)
  	  return $string;
  	else
  	  return $string.";\n";
  }
  
  public static function newLine($string=null)
  {
    return $string."\n";
  }
  
  public static function normalizeString ($s = '') 
  {
    $str = htmlentities($s);
    $str = preg_replace("/(&)([a-z])([a-z]+;)/i", '$2', $str);
    $str = preg_replace("/[^A-Z0-9]/i", '', $str);
    $str = preg_replace("/\s+/i", ' ', $str);	
    $str = trim($str);
    return $str;
  }
}